package cn.ecut.services;

import cn.ecut.dao.NewsDao;
import cn.ecut.model.News;

import java.sql.Date;
import java.sql.Timestamp;
import java.util.List;

public class Newsservices {
    private NewsDao newsDao=new NewsDao();
    public News Opennews(String id){
        return newsDao.OpenNews(id);
    }
    public boolean AddNews(News news){
        news.setDate(new Date(System.currentTimeMillis()));
        news.setId(news.getUserid()+System.currentTimeMillis());
        return newsDao.AddNews(news);
    }
    public boolean AddLikes(String id){
        return newsDao.AddLikes(id);
    }
    public List<News> FindNewsBySort(String sort){
        return newsDao.NewsListBySort(sort);
    }
    public List<News> FindNewsByTitle(String title){
        return  newsDao.NewsListByTitle(title);
    }
}
